package com.codeoss.framework.web;

import java.util.Arrays;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletListenerRegistrationBean;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.bstek.ureport.console.UReportServlet;

@Configuration
public class WebConfig {
	@Bean
	public FilterRegistrationBean YiInforFilter() {
		FilterRegistrationBean registrationBean = new FilterRegistrationBean();
		registrationBean.setFilter(new MiYunYunFilter());
		registrationBean.setUrlPatterns(Arrays.asList("/*"));
		return registrationBean;
	}
	
	@Bean
    public ServletListenerRegistrationBean YiInforContextListener(){
        ServletListenerRegistrationBean<MiYunYunContextListener> registrationBean = new ServletListenerRegistrationBean<>(new MiYunYunContextListener());
        return registrationBean;
    }
	
	@Bean
	public ServletRegistrationBean servletRegistrationBean() {
		return new ServletRegistrationBean(new UReportServlet(), "/ureport/*");
	}
}